import instance from '../utils/request'
// 抽取api 获取文章详情
const getArticle = ({ id }) => {
  return instance({
    method: 'get',
    url: '/v1_0/articles/' + id
  })
}
// 抽取api 关注用户
const followUser = ({ target }) => {
  return instance({
    method: 'post',
    url: '/v1_0/user/followings',
    data: {
      target
    }
  })
}
// 抽取api 取关用户
const unFollowUser = ({ target }) => {
  return instance({
    method: 'delete',
    url: '/v1_0/user/followings/' + target
  })
}
// 抽取api 文章点赞
const likings = ({ target }) => {
  return instance({
    method: 'post',
    url: '/v1_0/article/likings',
    data: {
      target
    }
  })
}
// 抽取api 取消文章点赞
const unLikings = ({ target }) => {
  return instance({
    method: 'delete',
    url: '/v1_0/article/likings/' + target
  })
}
// 抽取api 不喜欢文章
const dislike = ({ target }) => {
  return instance({
    method: 'post',
    url: '/v1_0/article/dislikes',
    data: {
      target
    }
  })
}
// 抽取api 取消不喜欢文章
const unDislike = ({ target }) => {
  return instance({
    method: 'delete',
    url: '/v1_0/article/dislikes/' + target
  })
}
export {
  getArticle,
  followUser,
  unFollowUser,
  likings,
  unLikings,
  dislike,
  unDislike
}
